package com.campus.commons.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableField;
import java.io.Serializable;

import com.campus.app.mapper.Update;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import javax.validation.groups.Default;

/**
 * <p>
 * 公告
 * </p>
 *
 * @author Rin
 * @since 2020-12-24
 */
@Data
@EqualsAndHashCode(callSuper = false)
@ApiModel(value="Annunciate对象", description="公告")
public class Annunciate implements Serializable {

    private static final long serialVersionUID = 1L;

    @TableId(value = "id", type = IdType.AUTO)
    @NotNull(groups = Update.class)
    @Min(value = 1,groups = {Update.class})
    private Integer id;

    @ApiModelProperty(value = "公告内容")
    private String content;

    @ApiModelProperty(value = "创建公告时间")
    @TableField("createTime")
    private Date createtime;

    @ApiModelProperty(value = "排序")
    private Integer sort;

    @ApiModelProperty(value = "更新时间")
    @TableField("upTime")
    private Date uptime;

    @ApiModelProperty(value = "公告状态 0 启动 1，禁用")
    @TableField("state")
    private Integer state;

    @ApiModelProperty(value = "公告类型")
    @TableField("annTypeId")
    private Integer annTypeId;

    public void setAnnTypeId(Integer annTypeId) {
        this.annTypeId = annTypeId;
        this.annType = AnnunciateType.annunciateTypeMap.get(annTypeId);
    }

    @ApiModelProperty(value = "公告类型")
    @TableField(exist = false)
    private AnnunciateType annType;


}
